<?php

/**
 * Order form.
 *
 * @package    lezgro
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class OrderForm extends BaseOrderForm {

    public function configure() {
        $this->setWidgets(array(
            'name' => new sfWidgetFormInput(),
            'organization' => new sfWidgetFormInput(),
            'email' => new sfWidgetFormInput(),
            'solution_id' => new sfWidgetFormInputHidden(),
//           'email'=>new sfWidgetFormInput(),
            'phone' => new sfWidgetFormInput(),
//           'uri'=>new sfWidgetFormInput(),
//           'type'=>new sfWidgetFormInput(),
            'description' => new sfWidgetFormTextarea()
        ));

        $this->setValidators(array(
            'name' => new sfValidatorString(array('required' => false)),
            'organization' => new sfValidatorString(array('required' => false)),
            'email' => new sfValidatorEmail(array(),array('invalid'=>'Email is invalid')),
            'solution_id' => new sfValidatorDoctrineChoice(array('multiple' => false, 'model' => $this->getRelatedModelName('Solution'), 'required' => true)),
            'phone' => new sfValidatorString(array('required' => false)),
//        'uri'=>new sfValidatorUrl(),
//        'type'=>new sfValidatorString(),
            'description' => new sfValidatorString(array('required' => false))
        ));

        $this->widgetSchema->setNameFormat('order[%s]');

        $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

        $this->setupInheritance();
    }

}
